package com.movie.ticket.sale.movieassembly.common;


import com.movie.ticket.sale.moviecommon.common.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * @author： Micsal
 * @create-time： 2020.12.04 16:02
 * @version： 1.0
 * @description： 票务微服务
 */

@FeignClient(value = "movie-ticket", contextId = "ticketAPI")
public interface MovieTicket {

    /**
     * 发送短信消息(任何)
     */
    @GetMapping("/message/send")
    Result sendMessage(@RequestParam("tel") String tel, @RequestParam("message") String message);


    /**
     * 校验4位短信验证码
     */
    @PostMapping("/message/check")
    Result checkMessage(@RequestParam("tel") String tel, @RequestParam("code") String code);
    //========================== 订单查询 ==========================================================

    /**
     * 查询购票订单
     */
    @GetMapping("/order/ticket/query")
    Result orderTicketQuery(@RequestParam("currentPage") int currentPage, @RequestParam("pageSize") int pageSize, @RequestParam("condition") Map<String, Object> condition);


    /**
     * 查询会员订单
     */
    @GetMapping("/order/vip/query")
    Result orderVipQuery(@RequestParam("currentPage") int currentPage, @RequestParam("pageSize") int pageSize, @RequestParam("condition") Map<String, Object> condition);


    /**
     * 查询会员订单
     */
    @GetMapping("/order/annual/query")
    Result orderAnnualQuery(@RequestParam("currentPage") int currentPage, @RequestParam("pageSize") int pageSize, @RequestParam("condition") Map<String, Object> condition);


    //========================= 支付 =================================================================

    /**
     * 生成订单，发起支付
     */
    @PostMapping("/aliPay")
    Result aliPay(@RequestParam("body") String body, @RequestParam("tradeNo") String tradeNo, @RequestParam("subject") String subject, @RequestParam("totalAmount") double totalAmount);


    /**
     * 支付宝异步回调
     */
    @RequestMapping("/aliPayNotifyUrl")
    String aliPayNotifyUrl(@RequestParam("out_trade_no")String out_trade_no, @RequestParam("trade_no")String trade_no, @RequestParam("trade_status")String trade_status);


    /**
     * 支付宝同步回调
     */
    @RequestMapping("/aliPayReturnUrl")
    String aliPayReturnUrl(@RequestParam("out_trade_no")String out_trade_no, @RequestParam("trade_no")String trade_no, @RequestParam("trade_status")String trade_status);

    /**
     * 支付宝退款
     */
    @RequestMapping("/refund")
    Result refund(@RequestParam("out_trade_no")String out_trade_no, @RequestParam("amount")double amount);

    //============================================ 评论 ============================================================

    /**
     * 添加评论
     */
    @PostMapping("/comment/add")
    Result addComment(@RequestParam("files")MultipartFile[] files, @RequestParam("score")double[] score, @RequestParam("comment")String comment);


    /**
     * 查询评论：用户、影院、boss
     * 验证身份
     * 查询评论
     */
    @GetMapping("/comment/query")
    Result queryComment(@RequestParam("currentPage")int currentPage, @RequestParam("pageSize")int pageSize, @RequestParam("condition")Map<String, Object> condition);


    //========================= 投诉 ===========================================================================

    /**
     * 添加投诉
     */
    @PostMapping("/complain/add")
    Result addComplain(@RequestParam("files")MultipartFile[] files, @RequestParam("score")double[] score, @RequestParam("comment")String comment);


    /**
     * 验证权限
     * 验证身份
     * 查询评论
     */
    @GetMapping("/complain/query")
    Result queryComplain(@RequestParam("currentPage")int currentPage, @RequestParam("pageSize")int pageSize, @RequestParam("condition")Map<String, Object> condition);


    //================================= 座位 ==========================================================

    /**
     * 添加座位
     */
    @PostMapping("/set/add")
    Result addSet(String sets);


    /**
     * 获取座位信息
     * 获取座位状态
     * 返回座位信息
     */
    @GetMapping("/set/query")
    Result querySet(int peridId);


}
